#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	char a[1001];
	int b[1001]; 
	int i,j,k[26],max=-1;
	memset(k,0,sizeof(k)); 
	cin.get(a,1001);
	for(i=0;i<strlen(a);i++)
	{
		if((a[i]>='a'&&a[i]<='z')||(a[i]>='A'&&a[i]<='Z'))
		{
			b[i]=a[i];
			switch(b[i])
			{
				case 65:
				case 97:k[0]++;break;
				
				case 66:
				case 98:k[1]++;break;
				
				case 67:
				case 99:k[2]++;break;
				
				case 68:
				case 100:k[3]++;break;
				
				case 69:
				case 101:k[4]++;break;
				
				case 70:
				case 102:k[5]++;break;
				
				case 71:
				case 103:k[6]++;break;
				
				case 72:
				case 104:k[7]++;break;
				
				case 73:
				case 105:k[8]++;break;
				
				case 74:
				case 106:k[9]++;break;
				
				case 75:
				case 107:k[10]++;break;
				
				case 76:
				case 108:k[11]++;break;
				
				case 77:
				case 109:k[12]++;break;
				
				case 78:
				case 110:k[13]++;break;
				
				case 79:
				case 111:k[14]++;break;
				
				case 80:
				case 112:k[15]++;break;
				
				case 81:
				case 113:k[16]++;break;
				
				case 82:
				case 114:k[17]++;break;
				
				case 83:
				case 115:k[18]++;break;
				
				case 84:
				case 116:k[19]++;break;
				
				case 85:
				case 117:k[20]++;break;
				
				case 86:
				case 118:k[21]++;break;
				
				case 87:
				case 119:k[22]++;break;
				
				case 88:
				case 120:k[23]++;break;
				
				case 89:
				case 121:k[24]++;break;
				
				case 90:
				case 122:k[25]++;break;
			}
		}
	}
	for(i=0;i<26;i++)
		if(k[i]>max)
		{
			max=k[i];
			j=i;
		}
	printf("%c %d\n",j+97,max);
	return 0;
}
